package com.design.graduation.asdemo.network.service;


import com.design.graduation.asdemo.network.model.LoginResult;
import com.design.graduation.asdemo.network.model.RoomListResult;
import com.design.graduation.asdemo.network.model.TokenResult;

import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.POST;
import rx.Observable;

/**
 * Created by weijianxing on 12/9/15.
 * <p/>
 * 登陆时使用的接口,一些不需要身份验证的接口可以在这里写,比如注册,登陆
 */
public interface LoginService {


    @FormUrlEncoded
    @POST("login.php")
    Observable<LoginResult> RxLogin(@Field("id") String id, @Field("password") String password);

    @FormUrlEncoded
    @POST("register.php")
    Observable<LoginResult> RxRegister(@Field("id") String id,
                                       @Field("password") String password,
                                       @Field("uid") String uid
    );

    @FormUrlEncoded
    @POST("setRoomMessage.php")
    Observable<LoginResult> setRoomMessage(@Field("position") String position,
                                           @Field("lon") String lon,
                                           @Field("lat") String lat,
                                           @Field("price") String price,
                                           @Field("content") String content,
                                           @Field("phone") String phone,
                                           @Field("imgurl") String imgurl,
                                           @Field("hash") String hash);

    @FormUrlEncoded
    @POST("getRoomList.php")
    Observable<RoomListResult> getRoomList(@Field("hash") String hash);


    @FormUrlEncoded
    @POST("getToken.php")
    Observable<TokenResult> getToken(@Field("id") String id);
}
